home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / windowtc.arc / WTUTOR10.C < prev    next >
Text File  |  1987-06-20  |  21KB  |  586 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <time.h>
  5. #include <dos.h>
  6. #include <conio.h>
  7. #include <w1.h>
  8. #include <windprot.h>
  9. #include <color.h>
  10.  
  11. #define RETKEY       13
  12. #define ESCKEY       27
  13. #define TRUE         1
  14. #define FALSE        0
  15.  
  16. typedef char str80[80];
  17. extern wndwstattype wndwstat[MAXWNDW];/*  window stats  */
  18. extern byteptr      wndwptr[MAXWNDW];/*  pointer to window on heap  */
  19. extern byte         li, licurrent;/*  level index, level index for swapping windows  */
  20.  
  21. void         show30windows(void);
  22. void         showinitialscreen(void);
  23. void         showgeneral(void);
  24. void         showlist(void);
  25. void         showinitwindow(void);
  26. void         showborders(void);
  27. void         showremovewindow(void);
  28. void         showmakewindow(void);
  29. void         showflicker(void);
  30. void         showscrollwindow(void);
  31. void         showtitlewindow(void);
  32. void         showspecialeffects(void);
  33. void         showmaxwndw(void);
  34. void         showqwik21(void);
  35. void         showprogramming(void);
  36. void         showeditor(void);
  37. void         readkb(int *);
  38. void         getkey(void);
  39. void         findnextstep(void);
  40. void         showwindows(void);
  41. int          random(int);
  42.  
  43.  
  44.     int          i, j, k, m;
  45.     int          oldcursor, battr, step ;
  46.     int          key;
  47.  
  48.     static str80        stra[16] = {
  49.       "",
  50.       "The windowing functions in  the file  WINDOW10.LIB",
  51.       "are  a  set of public domain routines  that  allow",
  52.       "Turbo C  to  create  incredibly fast multi - level",
  53.       "windows.   Created  under  the  Teamware  concept,",
  54.       "WINDOW10.LIB makes use of the quick screen writing",
  55.       "utilities  of Jim H. LeMay -- which were converted",
  56.       "from Turbo Pascal inline to external assembly. The",
  57.       "windows may  be  of any  size  (from 2x2 to screen",
  58.       "limits)  and  color  and  may  have one of several",
  59.       "different  border  styles and colors including  no",
  60.       "border.  They  also   work   in any   column  mode",
  61.       "40/80/etc.  These routines automatically configure",
  62.       "to your video card and  video  mode. All of  these",
  63.       "routines were converted from Turbo Pascal to Turbo",
  64.       "C, (SMALL MODEL) with the authors permission.     "};
  65.  
  66.     static str80        strb[11] = {
  67.       "The window function package",
  68.       "consists of five functions;",
  69.       "",
  70.       "      initwindow()",
  71.       "      makewindow()",
  72.       "      scrollwindow()",
  73.       "      removewindow()",
  74.       "      titlewindow()",
  75.       "",
  76.       "The functions are described",
  77.       "in the following windows:"};
  78.  
  79.     static str80        strc[8] = {
  80.       "initwindow",
  81.       "",
  82.       "FORMAT:   void initwindow (int windowattribute);",
  83.       "", 
  84.       "Initwindow initializes  several variables required  by  the",
  85.       "windowing package,  as well as selecting the foreground and",
  86.       "background colors of the initial screen display. Initwindow",
  87.       "must be called before using any of the other functions.    "}; 
  88.  
  89.     static str80        strd[17] = {
  90.       "makewindow", 
  91.       "",
  92.       "FORMAT:  void makewindow (int row,col,rows,cols,wattr,battr;",
  93.       "                                            BORDERS brdrsel);",
  94.       "",
  95.       "Makewindow puts a new blank window on the display.  The window starts", 
  96.       "at the upper left corner (row,col)  and extends for a number of  rows",
  97.       "and columns (rows,cols).   If a border exists, the actual  dimensions",
  98.       "of the Turbo C window will be 2 less than indicated in the makewindow",
  99.       "statement.  The border can be one of the following: (SEE w1.h)",
  100.       "",
  101.       "   nobrdr     - just window       evensolidbrdr - evenly solid",
  102.       "   blankbrdr  - blank spaces      thinsolidbrdr - thin solid line",
  103.       "   singlebrdr - single line       lhatchbrdr - light hatch",
  104.       "   doublebrdr - double line       mhatchbrdr - medium hatch",
  105.       "   mixedbrdr  - single/double     hhatchbrdr - heavy hatch",
  106.       "   solidbrdr  - solid             userbrdr   - user defined border"};
  107.  
  108.     static str80        stre[6] = {
  109.       "removewindow",
  110.       "FORMAT:   void removewindow(void);",
  111.       "",
  112.       "Removewindow removes the last window",
  113.       "remaining  on  the screen  from  the",
  114.       "makewindow function."};
  115.  
  116.     static str80        strf[2] = {
  117.       "See if your BIOS gives you flicker",
  118.       "when your screen rolls down next ..."};
  119.  
  120.     static str80        strg[19] = {
  121.       "",
  122.       "    scrollwindow",
  123.       "",
  124.       "",
  125.       "FORMAT:  void scrollwindow (byte rowbegin,rowend byte; DIRTYPE dir);",
  126.       "",
  127.       "The BIOS scroll that was used for this call may have worked just fine",
  128.       "for this window.  However, if  your screen just had some bad flicker ",
  129.       "as it was scrolling down, your BIOS is not flicker-free.  To keep the",
  130.       "display flicker-free,  to work on other  video pages  or an EGA, then",
  131.       "you will need this function.  The upward  scroll, used scrollwindow, ",
  132.       "so no flicker was seen then.  It also scrolls partial windows.",
  133.       "",
  134.       "The direction of the scroll can be any of the following:(SEE w1.h)",
  135.       "",
  136.       "    'up'   - to scroll up",
  137.       "    'down' - to scroll down",
  138.       "",
  139.       ""};
  140.  
  141.     static str80        strh[6] = {
  142.       "titlewindow",
  143.       "FORMAT:   void titlewindow (justify;title);",
  144.       "                   int justify; title str80",
  145.       "Titlewindow places a title in the top border",
  146.       "of the current window.  Justify permits left,",
  147.       "center or right justification of the title."};
  148.  
  149.     static str80        stri[18] = {
  150.       "There are now two special effects that can",
  151.       "enhance the window display:",
  152.       "   zoomeffect   - emulates the MACINTOSH.",
  153.       "   shadoweffect - places a left or right",
  154.       "              shadow underneath the menu.",
  155.       "These global variables can be placed anywhere",
  156.       "in your program.  zoomEffect is INT while",
  157.       "shadoweffect is of DIRtYPE.",
  158.       "                             press RETURN ...",
  159.       "CGA:",
  160.       "The CGA is self-regulating and controls the",
  161.       "zoom rate.",
  162.       "MDA and EGA:",
  163.       "These video cards are quite fast and need a",
  164.       "delay for the effect.  A default value of 11",
  165.       "milliseconds is used in a global INT",
  166.       "named 'zoomdelay' and shouldn't need any",
  167.       "adjustment."};
  168.  
  169.     static str80        strj[5] = {
  170.       " The maximum  number  of windows that",
  171.       " may be on the screen at any one time",
  172.       " is   specified   by   the   constant",
  173.       " \"MAXWNDW\".The compiled library uses",
  174.       " this value so do NOT change it......"};
  175.  
  176.     static str80        strk[9] = {
  177.       " In addition to windows, there are 15 powerful",
  178.       " Q screen write functions  you can use:",
  179.       "      qwritelv   qfillc     qstore",
  180.       "      qwritev    qfill      qrestore",
  181.       "      qwrite     qattr      qpage",
  182.       "      qwritec    qattrc     qwritepage",
  183.       "      qwritecv   gotorc     cursorchange ",
  184.       " In WINDOW10.ARC, compile and run QDEMO.C to see",
  185.       " all of these features."};
  186.  
  187.     static str80        strl[20] = {
  188.       " The functions are used as follows:",
  189.       "",
  190.       "  ....Your include files....",
  191.       "  #include <w1.h> ",
  192.       "  #include <windprot.h> ",
  193.       "  #include <color.h> ",
  194.       "  ...Your variables and functions...",
  195.       "  main(argc,argv)",
  196.       "    {",
  197.       "    initwindow (windowattribute);",
  198.       "    makewindow (row,col,rows,cols,wattr,battr,",
  199.       "                                     brdrsel);",
  200.       "    titlewindow (justify,'the window title');",
  201.       "    removewindow();",
  202.       "    }",
  203.       "  end.",
  204.       "",
  205.       " { Use one removewindow for each makewindow. }",
  206.       " { IMPORTANT: Remember to link in the proper }",
  207.       " {            WINDOW1x.lib library .         }"};
  208.  
  209.     static str80        strm[7] = {
  210.       "If you have any questions or comments,",
  211.       "please write to, or drop a note (CIS:)",
  212.       "",
  213.       "        Michael G. Mlachak",
  214.       "        4318 Stewart Court.",
  215.       "        East Chicago, IN 46312",
  216.       "        CIS - 76327,1410"};
  217.  
  218.     static str160       title = " TURBO-C WINDOWS (Continued) ";
  219.     static int          hidecursor = 0x2020; /*  Value to hide cursor  */
  220.  
  221.  
  222. void main(void)
  223. {
  224.    int dummy_li;
  225.  
  226.    initwindow(wiattr(BLUE, CYAN));
  227.    oldcursor = cursorchange(hidecursor);
  228.    gotorc(1, 1);
  229.    show30windows();
  230.    showinitialscreen();
  231.    showwindows();
  232.    /*  -- Use the following statment to return to the original screen.--  */
  233.    dummy_li = li;
  234.    for (i = 1; i <= dummy_li; i++)
  235.       removewindow();
  236.    qfill(1, 1, 25, 80, 112, ' ');
  237.    qwritec(12, 1, 80, 112, "This concludes the windows tutorial...");
  238.    sleep(2);
  239.    oldcursor = cursorchange(oldcursor);
  240. }  /* of main */
  241.  
  242. void         show30windows()
  243. {
  244.    /*  -- Throw out 30 windows 4 times --  */
  245.    int hold_li;
  246.  
  247.    for (m = 1; m <= 4; m++) {
  248.      for (i = 1; i <= 28; i++) {
  249.        j = random(70);
  250.        k = random(21);
  251.        makewindow(k + 1, j + 1, 5, 11, wiattr(YELLOW, RED), wiattr(YELLOW, RED), lhatchbrdr);
  252.        qwrite(k + 3, j + 3, -1, "WINDOWS");
  253.      }
  254.      hold_li = li;
  255.      if (m == 4)
  256.         sleep(3);
  257.      else
  258.        sleep(1);
  259.      for (i = 1; i <= hold_li; i++) {
  260.        removewindow();
  261.      }
  262.    } /* for m= 1; */
  263. } /* of show30windows */
  264.  
  265. void         showinitialscreen()
  266. {
  267.    /*  -- Create initial screen --  */
  268.    qwritec(1, 1, 80, -1, "TURBO C - Windows Tutorial");
  269.    qwritec(2, 1, 80, -1, "Version 1.0 -- (C) COPYRIGHT 1987 Michael G. Mlachak");
  270.    qwritec(3, 1, 80, -1, "Original TEAMWARE concept (C) COPYRIGHT Jim H. LeMay, Michael Burton");
  271.    qwritec(5, 1, 80, 112, "For each of the following displays:");
  272.    qwrite(6, 26, 112, "1. Press RETURN to continue.");
  273.    qwrite(7, 26, 112, "2. Press ESC to back up.");
  274.    qwritec(12, 1, 80, 112, "This is the original screen without windows.");
  275.    step = 0;
  276. }  /* of showinitialscreen() */
  277.  
  278. void         showgeneral()
  279. {
  280.    /*  -- General description --  */
  281.    shadoweffect = right;
  282.    makewindow(4, 15, 19, 52, wiattr(BLACK, GREEN), wiattr(BLACK, GREEN), mixedbrdr);
  283.    titlewindow(center, " TURBO-C WINDOWS ");
  284.    for (j = 1; j <= 16; j++)
  285.      qwritev(wndwstat[li].wsrow + j, wndwstat[li].wscol + 1, -1, stra[j-1]);
  286.    shadoweffect = nodir;
  287. }  /* showgeneral */
  288.  
  289. void         showlist() 
  290.    /*  -- List of Procedures --  */
  291.    makewindow(5, 2, 15, 33, wiattr(BLACK, CYAN), wiattr(WHITE, BLUE), mhatchbrdr); 
  292.    titlewindow(center, " Five Functions ");
  293.    for (j = 1; j <= 2; j++)
  294.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 2, -1, strb[j-1]);
  295.    for (j = 3; j <= 9; j++)
  296.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 2, wiattr(WHITE, CYAN), strb[j-1]);
  297.    for (j = 10; j <= 11; j++)
  298.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 2, -1, strb[j-1]);
  299. }   /* showlist() */
  300.  
  301. void         showinitwindow() 
  302.    /*  -- InitWindow description --  */ 
  303.    makewindow(11, 17, 12, 63, wiattr(YELLOW, RED), wiattr(YELLOW, RED), singlebrdr);
  304.    titlewindow(left, title); 
  305.    qwritev(wndwstat[li].wsrow + 2, wndwstat[li].wscol + 2, wiattr(WHITE, BLUE), strc[0]);
  306.    for (j = 2; j <= 4; j++)
  307.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 2, wiattr(CYAN, RED), strc[j-1]);
  308.    for (j = 5; j <= 8; j++)
  309.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 2, wiattr(WHITE, RED), strc[j-1]);
  310. } /* showinitwindow() */
  311.  
  312. void         showmakewindow()
  313.    /*  -- MakeWindow description --  */ 
  314.    makewindow(4, 7, 21, 71, wiattr(LIGHTMAGENTA, BLUE), wiattr(LIGHTMAGENTA, BLUE), solidbrdr);
  315.    titlewindow(left, title);
  316.    qwritev(wndwstat[li].wsrow + 2, wndwstat[li].wscol + 5, wiattr(YELLOW, RED), strd[0]);
  317.    for (j = 2; j <= 4; j++)
  318.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 1, wiattr(LIGHTRED, BLUE), strd[j-1]);
  319.    for (j = 5; j <= 17; j++)
  320.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 1, wiattr(YELLOW, BLUE), strd[j-1]);
  321. } /* showmakewindow () */
  322.  
  323. void         showborders()
  324. {
  325.    /*  -- Show different borders --  */
  326.    for (i = 0; i <= 5; i++)  {
  327.      if (i == 1)
  328.         battr = wiattr(YELLOW, YELLOW);
  329.      else
  330.         battr = wiattr(YELLOW, GREEN);
  331.      makewindow(2 + 2 * i, 13 + 3 * i, 5, 10, wiattr(YELLOW, GREEN), battr, i);
  332.    }
  333.    /* with Brdr[UserBrdr] DO  { **/
  334. /*   {
  335.      TL = '\017';
  336.      TH = '\017';
  337.      TR = '\017';
  338.      LV = '▐';
  339.      RV = '▌';
  340.      BL = '\017';
  341.      BH = '\017';
  342.      BR = '\017';
  343.    }
  344.     }  END WITH */
  345.    for (i = 6; i <= 11; i++) {
  346.      makewindow(24 - 2 * i, 24 + 3 * i, 5, 10, wiattr(YELLOW, GREEN), battr, i);
  347.    }
  348. }  /* showborders () */
  349.  
  350. void         showremovewindow()
  351. {
  352.    /*  -- RemoveWindow description --  */
  353.    makewindow(11, 20, 11, 40, wiattr(BLACK, BROWN), wiattr(BLACK, BROWN), doublebrdr);
  354.    titlewindow(left, title);
  355.    qwritev(wndwstat[li].wsrow + 2, wndwstat[li].wscol + 5, wiattr(WHITE, MAGENTA), stre[0]);
  356.    qwritev(wndwstat[li].wsrow + 4, wndwstat[li].wscol + 2, wiattr(YELLOW, BROWN), stre[1]);
  357.    for (j = 3; j <= 6; j++)
  358.       qwritev(wndwstat[li].wsrow + 2 + j, wndwstat[li].wscol + 2, wiattr(WHITE, BROWN), stre[j-1]);
  359. } /* showremoveeindow() */
  360.  
  361. void         showflicker()
  362. {
  363.    /*  -- Flicker Note --  */
  364.    makewindow(11, 22, 4, 40, wiattr(BLACK, BROWN), wiattr(BLACK, BROWN), mixedbrdr);
  365.    for (j = 1; j <= 2; j++)
  366.      qwritev(wndwstat[li].wsrow + j, wndwstat[li].wscol + 2, -1, strf[j-1]);
  367. }  /* showflicker() */
  368.  
  369. void         showscrollwindow()
  370. {
  371.    /*  -- ScrollWindow description --  */
  372.      gotorc(wndwstat[li].wsrow + 1, wndwstat[li].wscol + 1);
  373.      for (j = 1; j <= 19; j++)
  374.         window(8,5,76,22,wiattr(LIGHTMAGENTA, BLUE));
  375.      for (j = 1; j <= 19; j++) {
  376.         scrollwindow(1, 19, up);
  377.         qwritev(wndwstat[li].wsrow + 19, wndwstat[li].wscol + 1, -1, strg[j-1]);
  378.      }
  379. }  /* showscrollwindow() */
  380.  
  381. void         showtitlewindow()
  382. {
  383.    /*  -- TitleWindow description --  */
  384.    makewindow(12, 16, 11, 49, wiattr(RED, LIGHTGRAY), wiattr(RED, LIGHTGRAY), evensolidbrdr);
  385.    titlewindow(left, title); 
  386.    qwritev(wndwstat[li].wsrow + 2, wndwstat[li].wscol + 5, wiattr(LIGHTGREEN, BLUE), strh[0]);
  387.    qwritev(wndwstat[li].wsrow + 4, wndwstat[li].wscol + 2, wiattr(BLACK, LIGHTGRAY), strh[1]);
  388.    for (j = 3; j <= 6; j++)
  389.       qwritev(wndwstat[li].wsrow + 2 + j, wndwstat[li].wscol + 2, wiattr(GREEN, LIGHTGRAY), strh[j-1]);
  390. } /* showtitlewindow() */
  391.  
  392. void         showspecialeffects() 
  393.    /*  -- Special effects description --  */ 
  394.    if (qwait)
  395.       shadoweffect = right; 
  396.    makewindow(6, 25, 14, 49, wiattr(BLACK, GREEN), wiattr(WHITE, GREEN), doublebrdr); 
  397.    titlewindow(center, " Special Effects "); 
  398.    for (j = 1; j <= 2; j++)
  399.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 2, -1, stri[j-1]);
  400.    for (j = 3; j <= 5; j++) 
  401.       qwritev(wndwstat[li].wsrow + 2 + j, wndwstat[li].wscol + 2, wiattr(WHITE, GREEN), stri[j-1]);
  402.    for (j = 6; j <= 9; j++)
  403.       qwritev(wndwstat[li].wsrow + 3 + j, wndwstat[li].wscol + 2, -1, stri[j-1]);
  404.    /**scanf("\n");  **/
  405.    qfill(wndwstat[li].wsrow + 2, wndwstat[li].wscol + 2, 11, 45, wiattr(BLACK, GREEN), ' ');
  406.    qwritev(wndwstat[li].wsrow + 2, wndwstat[li].wscol + 2, wiattr(WHITE, GREEN), stri[9]);
  407.    for (j = 11; j <= 12; j++)
  408.       qwritev(wndwstat[li].wsrow + j - 8, wndwstat[li].wscol + 2, -1, stri[j-1]);
  409.    qwritev(wndwstat[li].wsrow + 6, wndwstat[li].wscol + 2, wiattr(WHITE, GREEN), stri[12]);
  410.    for (j = 14; j <= 18; j++)
  411.       qwritev(wndwstat[li].wsrow + j - 7, wndwstat[li].wscol + 2, -1, stri[j-1]);
  412.    shadoweffect = nodir; 
  413. } /* showspecialeffects() */
  414.  
  415. void         showmaxwndw() 
  416.    /*  -- MaxWndw constant --  */ 
  417.    makewindow(17, 9, 7, 38, wiattr(BLACK, BROWN), wiattr(BLACK, BROWN), nobrdr); 
  418.    titlewindow(center, "- WINDOW LIMITS -"); 
  419.    for (j = 1; j <= 5; j++)
  420.       qwritev(wndwstat[li].wsrow + j, wndwstat[li].wscol, -1, strj[j-1]);
  421. } /* showmaxwndw() */
  422.  
  423. void         showqwik21() 
  424.    /*  -- QWIK21.INC procedures --  */
  425.    makewindow(8, 20, 15, 51, wiattr(YELLOW, RED), wiattr(YELLOW, RED), evensolidbrdr); 
  426.    titlewindow(center, " Utility Functions ");
  427.    for (j = 1; j <= 2; j++)
  428.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 1, -1, strk[j-1]);
  429.    for (j = 3; j <= 7; j++)
  430.       qwritev(wndwstat[li].wsrow + 2 + j, wndwstat[li].wscol + 1, wiattr(WHITE, RED), strk[j-1]);
  431.    for (j = 8; j <= 9; j++) 
  432.       qwritev(wndwstat[li].wsrow + 3 + j, wndwstat[li].wscol + 1, -1, strk[j-1]);
  433. } /* showqwik21() */
  434.  
  435. void         showprogramming() 
  436.    /*  -- Programming for WINDOW33.INC --  */ 
  437.    makewindow(2, 25, 23, 50, wiattr(YELLOW, MAGENTA), wiattr(YELLOW, MAGENTA), mhatchbrdr); 
  438.    for (j = 1; j <= 20; j++)
  439.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 1, -1, strl[j-1]);
  440. } /* showprogramming() */
  441.  
  442. void         showeditor() 
  443.    /*  -- Editor for WINDOW33.INC --  */ 
  444.    if (qwait)
  445.       shadoweffect = right; 
  446.    makewindow(8, 20, 11, 42, wiattr(BLACK, BROWN), wiattr(BLACK, BROWN), hhatchbrdr); 
  447.    titlewindow(center, " Teamware Editor: "); 
  448.    for (j = 1; j <= 7; j++)
  449.       qwritev(wndwstat[li].wsrow + 1 + j, wndwstat[li].wscol + 2, wiattr(WHITE, BROWN), strm[j-1]);
  450.    shadoweffect = nodir; 
  451. }  /* showeditor */
  452.  
  453. void        readkb(key)
  454. int         *key; 
  455.  
  456.   int t_key;
  457.  
  458.   t_key = getch();
  459.   if (t_key ==0)     /* extended character hit */
  460.      t_key = getch();
  461.    *key = t_key;
  462. } /* readkb() */
  463.  
  464. void         getkey() 
  465.   do { 
  466.      readkb(&key);
  467.   }  while (!((key == RETKEY) || (key == ESCKEY)));
  468. }  /* getkey() */
  469.  
  470. void         findnextstep()
  471. {
  472.   switch (key) {
  473.       case ESCKEY:
  474.          if (step > 0) {
  475.              removewindow();
  476.              switch (step) {
  477.                 case 5:
  478.                         for (j = 1; j <= 11; j++)
  479.                            removewindow();
  480.                 break;
  481.                 case 7:
  482.                        showborders();
  483.                        showremovewindow();
  484.                 break;
  485.                 case 8:
  486.                        step = 4;
  487.                 break;
  488.              } /*  switch step  */
  489.             step = step - 1;
  490.          } /* if step > 0 */
  491.       break;
  492.  
  493.       case RETKEY:
  494.          step = step + 1;
  495.          if ((step >=9) && (step <=13))
  496.             zoomeffect = TRUE;
  497.          else
  498.             zoomeffect = FALSE;
  499.          switch (step) {
  500.             case 7:
  501.                    for (i = 0; i <= 12; i++)
  502.                       removewindow();
  503.             break;
  504.             case 8:
  505.                    removewindow();
  506.             break;
  507.          } /* switch step */
  508.       break;
  509.   } /*  switch key  */
  510. }  /* findnextstep() */
  511.  
  512. void         showwindows(void)
  513. {
  514.   do {
  515.     getkey();
  516.     findnextstep();
  517.     if (key == RETKEY) {
  518.        switch (step) {
  519.           case 1:
  520.                  showgeneral();
  521.           break;
  522.           case 2:
  523.                  showlist();
  524.           break;
  525.           case 3:
  526.                  showinitwindow();
  527.           break;
  528.           case 4:
  529.                  showmakewindow();
  530.           break;
  531.           case 5:
  532.                  showborders();
  533.           break;
  534.           case 6:
  535.                  showremovewindow();
  536.           break;
  537.           case 7:
  538.                  showflicker();
  539.           break;
  540.           case 8:
  541.                  showscrollwindow();
  542.           break;
  543.           case 9:
  544.                  showtitlewindow();
  545.           break;
  546.           case 10:
  547.                  showspecialeffects();
  548.           break;
  549.           case 11:
  550.                  showmaxwndw();
  551.           break;
  552.           case 12:
  553.                  showqwik21();
  554.           break;
  555.           case 13:
  556.                   showprogramming();
  557.           break;
  558.           case 14:
  559.                   showeditor();
  560.           break;
  561.       } /* switch step */
  562.     } /* if key ==RETKEY */
  563.    }  while (step != 15) ;
  564. }  /* showindows */
  565.  
  566. int random(seed)
  567. {
  568.   int hold;
  569.  
  570.      hold= rand();
  571.      if (hold > 127)
  572.        hold = hold % 127;
  573.      hold = hold % seed;
  574.    return(hold);
  575. }
  576.